.my_switch {
    display: inline-block;
    position: relative;
    width: 60px;
    height: 32px;
}
.my_switch > input {
    display: none;
}
.my_switch > label {
    display: block;
    width: 100%;
    height: 100%;
    background: #f5222d;
    border-radius: 32px;
    cursor: pointer;
    transition: background .3s ease-out;
}
.my_switch > label::before {
    content: '';
    display: block;
    width: 26px;
    height: 26px;
    position: absolute;
    top: 3px;
    left: 4px;
    background: #f5f5f5;
    border-radius: 50%;
    animation: uncheck .3s ease-out;
    transform-origin: 0 0;
}

/* 选中状态 */
.my_switch > input:checked + label {
    background: #52c41a;
}
.my_switch > input:checked + label::before {
    animation: check .3s ease-out;
    transform: translateX(26px);
}

/* 动画 */
@keyframes uncheck {
    0% {
        transform: translateX(26px);
    }
    20% {
        transform: translateX(14px) scale(X1.5);
    }
    40% {
        transform: translateX(0px) scaleX(.75);
    }
    70% {
        transform: translateX(6px) scaleX(1);
    }
    100% {
        transform: translateX(2px);
    }
}

@keyframes check {
    0% {
        transform: translateX(2px);
    }
    20% {
        transform: translateX(13px) scaleX(1.5);
    }
    40% {
        transform: translateX(26px) scaleX(.75);
    }
    70% {
        transform: translateX(20px) scaleX(1);
    }
    100% {
        transform: translateX(26px);
    }
}